import express from 'express';
import dotenv from 'dotenv';
import userRoutes from './routes/userRoutes';
import uploadFile from './routes/uploadRoutes';
import creatPost from './routes/postsRouter' //作品
import douGuo from './routes/douguoRouter'
import categoryRoutes from './routes/categoryRoutes';
import items from './routes/itemsRoutes';
import attributes from './routes/attributesRouter'


dotenv.config();

const app = express();
app.use(require('cors')())
const PORT = process.env.PORT || 3001;

app.use(express.json());
app.use('/api', userRoutes);
app.use('/file', uploadFile);
app.use('/posts', creatPost)
app.use('/douguo', douGuo)
app.use('/api/categories', categoryRoutes);
app.use('/items', items)
app.use('/attributes',attributes)

app.listen(PORT, () => {
  console.log(`Server running on http://localhost:${PORT}`);
});
